package com.ficus.road.maintain.core.model.smartnew;

import com.ficus.road.maintain.core.model.zh.DiseaseLocationZH;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;

/**
 * @author xiawen yang
 * @date 2022/7/19 下午4:20
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SmartRoadDisease {
    @Id
    private String hitId;

    private String roadId;

    private String roadName;

    private String roadType;

    private String roadLength;

    private String roadGrade;

    private String startStake;

    private String endStake;
    // 病害类型
    private String type;
    // 照片
    private String picUrl;
    // 发现时间
    private long firstHitTime;

    public static SmartRoadDisease convert2SmartRoadDisease(DiseaseLocationZH.DiseaseLocationResponse location) {
        return SmartRoadDisease.builder()
                .hitId(location.getDiseaseid())
                .roadName(location.getRoadname())
                .roadId(location.getRoadid())
                .roadType(location.getRoadtype())
                .roadLength(location.getRoadlength())
                .roadGrade(location.getRoadgrade())
                .startStake(location.getStartlocationdesc())
                .endStake(location.getEndlocationdesc())
                .build();
    }
}
